﻿// =================================================================== 
// 项目说明
//====================================================================
// sushee @Copy Right 2019
// 文件： InterfaceDataVehicleRepository.cs
// 项目名称：斑马车务
// 创建时间：2019/11/11
// 负责人：sushee
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using Dapper;
using YouWei.Infrastructure.Entity;

namespace YouWei.Infrastructure.Repository
{
	/// <summary>
	///接口数据-行驶证 仓储层
	/// </summary>	
	public class InterfaceDataVehicleRepository:BaseRepository<InterfaceDataVehicle>
	{		
    
        #region 构造

        public InterfaceDataVehicleRepository() : base(){}

        public InterfaceDataVehicleRepository(string connectionString) : base(connectionString){}

        public InterfaceDataVehicleRepository(DatabaseContext dbContext) : base(dbContext){}

        #endregion

        public InterfaceDataVehicle GetLocalSuccessRecord(string hpzl, string hphm, DateTime date)
        {
            string sql = "SELECT * FROM InterfaceDataVehicle with(nolock) WHERE hpzl=@hpzl and hphm=@hphm  and CreatedTime>@CreatedTime ORDER BY DataID DESC";
            return dbContext.Connection.QueryFirstOrDefault<InterfaceDataVehicle>(sql, new { hpzl = hpzl, hphm = hphm, CreatedTime = date });
        }
    }
}